package com.xuxin.baby.event;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.LogUtils;
import com.xuxin.baby.base.BaseFragment;

import org.greenrobot.eventbus.EventBus;

/**
 * Created by xu_xin
 * Created on 2020/12/9 0009
 */
public abstract class BaseEventFragment extends BaseFragment {
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!EventBus.getDefault().isRegistered(this)) {
            LogUtils.e("注册监听事件2");
            EventBus.getDefault().register(this);
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (EventBus.getDefault().isRegistered(this)) {
            LogUtils.e("取消注册监听事件2");
            EventBus.getDefault().unregister(this);
        }
    }
}